<!--
* description: 车辆管理-库存汇总查询
* author: ligy
* createdDate: 2020-11-19
-->
<template>
  <div class="app-container app-container-table">
    <one-table-template
      ref="multipleTable"
      :dynamic-buttons="tableButtons"
      :dynamic-components="tableComponents"
      :dynamic-api-config="dynamicApiConfigs"
      :dynamic-table-cols="tableCols"
      :dynamic-form-fields="formField"
      :dynamic-is-show-select="false"
      :dynamic-is-init-table="true"
      :dynamic-is-fix-choose="false"
      :dynamic-is-fix-index="false"
      :dynamic-api-style="'restful'"
    />
  </div>
</template>

<script>
// import { formMixins } from '@/components/mixins/formMixins'
import { oneTableWithViewTemplateMixins } from '@/components/mixins/oneTableWithViewTemplateMixins'
import OneTableTemplate from '@/components/templates/oneTable'
import api from '@/api/vehicleManagement'
import commApi from '@/api/ve'
export default {
  components: {
    OneTableTemplate
  },
  mixins: [oneTableWithViewTemplateMixins],
  data() {
    return {
      dynamicApiConfigs: api.inventorySummaryQuery,
      // 动态生成网格列
      tableCols: [
        {
          prop: 'carSeriesCN',
          label: '车系'
        },
        {
          prop: 'carConfigCN',
          label: '基础车型'
        },
        {
          prop: 'optionalPagName',
          label: '选装包'
        },
        {
          prop: 'carColorName',
          label: '车身颜色'
        },
        {
          prop: 'carIncolorName',
          label: '内饰颜色'
        },
        {
          prop: 'number',
          label: '数量'
        },
        {
          prop: 'carHouseName',
          label: '仓库'
        },
        {
          prop: 'SaleStatus',
          label: '车型销售状态'
        }
      ],
      tableComponents: [
        // ...commFields.ModelOptionsNotDisabled(true),
        {
          compKey: 'carSeries',
          labelName: '车系：',
          codeField: 'carSeriesId',
          textField: 'carSeriesCn',
          oFields: 'carSeriesId,carSeriesCn',
          customObj: { api: commApi.vehicleQuery, selectType: '1' },
          component: () => import('@/components/org/commonSelect'),
          isRequire: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'carConfig',
          labelName: '基础车型：',
          codeField: 'carConfigId',
          textField: 'carConfigCn',
          component: () => import('@/components/org/commonSelect'),
          oFields: 'carConfigId,carConfigCn',
          parentFileds: 'value:carSeriesId',
          customObj: {
            listQuery: { carSeriesId: '' },
            api: commApi.ModelQuery, selectType: '1'
          },
          isRequire: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'optionalPag',
          labelName: '选装包：',
          codeField: 'optionalPagId',
          textField: 'optionalPagName',
          component: () => import('@/components/org/commonSelect'),
          parentFileds: 'value:carConfigId',
          oFields: 'optionalPagId,optionalPagName',
          customObj: {
            listQuery: {
              carConfigId: ''
            },
            api: commApi.queryPackByModel, selectType: '1'
          },
          type: 'inputText',
          isRequire: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'carColor',
          labelName: '车身颜色：',
          codeField: 'carColorId',
          textField: 'carColorName',
          component: () => import('@/components/org/commonSelect'),
          parentFileds: 'value:carConfigId|optionalPagId',
          oFields: 'carColorId,carColorName',
          customObj: {
            listQuery: {
              carConfigId: '',
              optionalPagId: ''
            },
            api: commApi.queryBodyColorByModel, selectType: '1'
          },
          type: 'inputText',
          isRequire: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'carIncolor',
          labelName: '内饰颜色：',
          codeField: 'carIncolorId',
          textField: 'carIncolorName',
          component: () => import('@/components/org/commonSelect'),
          parentFileds: 'value:carConfigId|optionalPagId',
          oFields: 'carIncolorId,carIncolorName',
          customObj: {
            listQuery: {
              carConfigId: '',
              optionalPagId: ''
            },
            api: commApi.queryInnerColorByModel, selectType: '1'
          },
          type: 'inputText',
          isRequire: false,
          isMust: false,
          span: 6
        },
        {
          compKey: 'SaleStatus',
          labelName: '车型销售状态：',
          codeField: 'SaleStatus',
          lookuptype: 'VE1323',
          component: () => import('@/components/org/LookupValue'),
          type: 'dropdownList',
          isMust: false,
          span: 6
        },
        {
          compKey: 'carStockHouse',
          labelName: '仓库：',
          codeField: 'carStockHouseId',
          textField: 'carStockHouseName',
          component: () => import('@/views/ve/planReport/components/multipleSearchInput'),
          type: 'inputText',
          isMust: false,
          dataToObject: {
            // 控制弹窗页面 搜索 网格 元素
            tableComponents: [
              {
                compKey: 'compKey1',
                labelName: '仓库编码：',
                codeField: 'stockCode',
                component: () => import('@/components/org/commonInput'),
                type: 'inputText',
                isMust: true,
                span: 8
              },
              {
                compKey: 'compKey2',
                labelName: '仓库名称：',
                codeField: 'stockName',
                component: () => import('@/components/org/commonInput'),
                type: 'inputText',
                isMust: true,
                span: 8
              }
            ],
            tableCols: [
              {
                prop: 'stockCode',
                label: '仓库编码'
              },
              {
                prop: 'stockName',
                label: '仓库名称'
              }
            ],
            formField: {
              stockCode: '',
              stockName: '',
              warehouseId: '1'
            },
            returnField: {
              prop: 'stockName',
              label: '仓库名称'
            },
            oFields: 'stockId,stockName',
            api: {
              APIUrl: '/mp/e3sh/vesale/common/geographicDataService/ListOfWarehouse.do'
            }
          },
          span: 6
        }
      ],
      tableButtons: [
        {
          conmpKey: 'btenKey1',
          type: 'primary',
          size: 'small',
          text: '查询',
          clickEvent: () => this.queryTable(1),
          position: 'right'
        },
        {
          conmpKey: 'btenKey2',
          type: '',
          size: 'small',
          text: '重置',
          clickEvent: () => this.reset(),
          position: 'right'
        }
      ],
      formField: this.$utils.getFormField(this, {
        SaleStatus: '',
        carSeriesId: '',
        carConfigId: '',
        optionalPagId: '',
        carColorId: '',
        carIncolorId: '',
        carStockHouseId: '',
        carStockHouseName: ''
      })
    }
  },
  methods: {}
}
</script>

<style>
</style>
